#include <iostream>
using namespace std;


class Cat{
    public:
    Cat& getCatAge(Cat& c) {
        if (this->age > c.age) {
            return *this; // 返回当前对象
        } else {
            return c; // 返回另一个对象
        }
    }

    void setAge(int _age) {
        age = _age;
    }
    int getAge() const {
        return age;
    }
    private:
    int age;
};
int main(int argc, char const *argv[])
{
    Cat c1;
    Cat c2;
    c1.setAge(3);
    c2.setAge(5);

    Cat &olderCat =c1.getCatAge(c2); // 比较 c1 和 c2 的年龄
    cout << "老猫是： " << olderCat.getAge() << " years old." << endl;
    return 0;
}
